﻿using System;
using System.Windows.Input;

internal class ScreenView : BufferView
{
    private MyMouseAdapter mouse;
    private bool notifyImageReady;
    private static int state3;

    internal ScreenView(NES nes, int width, int height) : base(nes, width, height)
    {
    }

    internal override void imageReady(bool skipFrame)
    {
        base.imageReady(skipFrame);
        if (this.notifyImageReady)
        {
            base.nes.getGui().imageReady(skipFrame);
        }
    }

    internal override void init()
    {
        if (this.mouse == null)
        {
            this.mouse = new MyMouseAdapter(this);
        }
        base.init();
    }

    private static void mouseDown(object event_sender, MouseEventArgs e)
    {
    }

    internal virtual bool NotifyImageReady
    {
        set
        {
            this.notifyImageReady = value;
        }
    }

    private class MyMouseAdapter
    {
        private ScreenView enclosingInstance;
        internal long lastClickTime;

        internal MyMouseAdapter(ScreenView enclosingInstance)
        {
            this.InitBlock(enclosingInstance);
        }

        private void InitBlock(ScreenView enclosingInstance)
        {
            this.enclosingInstance = enclosingInstance;
        }

        internal void mouseClicked(object event_sender, EventArgs me)
        {
        }

        internal void mousePressed(object event_sender, MouseEventArgs me)
        {
        }

        internal void mouseReleased(object event_sender, MouseEventArgs me)
        {
            if ((this.Enclosing_Instance.nes != null) && (this.Enclosing_Instance.nes.memMapper != null))
            {
                this.Enclosing_Instance.nes.memMapper.setMouseState(false, 0, 0);
            }
        }

        internal ScreenView Enclosing_Instance
        {
            get
            {
                return this.enclosingInstance;
            }
        }
    }
}

